import psutil
import socket


def get_all_ip_addresses():
    addresses = {}
    for interface, addrs in psutil.net_if_addrs().items():
        for addr in addrs:
            if addr.family == socket.AF_INET:
                ip = addr.address
                addresses[interface] = ip
    return addresses


def print_ip_addresses():
    addresses = get_all_ip_addresses()
    for interface, ip in addresses.items():
        print(f"网卡名称: {interface}, IP 地址: {ip}")





if __name__ == "__main__":
    print_ip_addresses()
